package com.hanhai.zrb.api.biz.dao.mybatis;

import java.util.Date;
import java.util.List;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import com.hanhai.zrb.api.biz.dao.mybatis.base.BaseMapper;
import com.hanhai.zrb.model.project.Project;
import com.hanhai.zrb.model.project.ProjectExample;
import com.hanhai.zrb.model.project.ProjectSolrDto;

public interface ProjectMapper extends BaseMapper{
    int countByExample(ProjectExample example);

    int deleteByExample(ProjectExample example);

    int deleteByPrimaryKey(Long id);

    int insert(Project record);

    int insertSelective(Project record);

    List<Project> listAll();
    
    List<Project> selectByExample(ProjectExample example);

    Project selectByPrimaryKey(Long id);

    int updateByExampleSelective(@Param("record") Project record, @Param("example") ProjectExample example);

    int updateByExample(@Param("record") Project record, @Param("example") ProjectExample example);

    int updateByPrimaryKeySelective(Project record);

    int updateByPrimaryKey(Project record);
    
    List<Project> queryByOwnerId(@Param("owner") String owner,@Param("pushTime") Date pushTime,@Param("state") Integer state);
    
    List<Project> queryByIdList(@Param("list") List<Long> list);

	void updatePic(@Param("id") Long id, @Param("pic") String pic);
	
	ProjectSolrDto selectSolrProject(Long id);
	
	ProjectSolrDto selectSolrProjectSimple(Long id);
	
	/**
	 * 查询用户发布的所有项目
	 * @param userId
	 * @return
	 */
	@Select("select count(1) from project where pusher= #{userId} and project_status = 203")
	int countByUid(Long userId);
}